package com.parking.status.sync.netty.service;

import com.parking.status.sync.netty.entity.*;
import org.springframework.stereotype.Component;

/**
 * Created by Administrator on 2015/9/25.
 */
@Component
public class ResponseFactory {

    public ResponsePre createResponse(int seqno, String code, String result) {
        ResponsePre response = null;
        if (code.equalsIgnoreCase(MessageType.CODE_SYNC_PARKING_INFO)) {
            response = new ResponseSyncParkingInfo(seqno, code, result, ResultCode.getMessage(result));
        } else if (code.equalsIgnoreCase(MessageType.CODE_BEAT)) {
            response = new ResponseHeartBeat(seqno, code, result, ResultCode.getMessage(result));
        } else if (code.equalsIgnoreCase(MessageType.CODE_PARKING_CHECKIN)) {
            response = new ResponseParkingCheckin(seqno, code, result, ResultCode.getMessage(result));
        } else if (code.equalsIgnoreCase(MessageType.CODE_PARKING_IN)) {
            response = new ResponseParkingIn(seqno, code, result, ResultCode.getMessage(result));
        } else if (code.equalsIgnoreCase(MessageType.CODE_PARKING_OUT)) {
            response = new ResponseParkingOut(seqno, code, result, ResultCode.getMessage(result));
        } else {

        }
        return response;
    }
}
